<?php
class model_auth {
	/**
	 * 是否通过
	 * @return bool
	 */
	public function access() {
		return isset($_SESSION['pms']['access']) ? $_SESSION['pms']['access'] : false;
	}

	/**
	 * 登录
	 * @param string $password
	 * @return bool
	 */
	public function login($password) {
		$model_var = new model_var();
		$auth_password = $model_var->get('auth_password');
		
		if(md5(md5(trim($password))) === $auth_password) {
			$_SESSION['pms']['access'] = true;
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * 退出
	 */
	public function logout() {
		unset($_SESSION['pms']);
	}
}
?>